// singleRowCard.dart
import 'package:flutter/material.dart';
import 'package:roundcheckbox/roundcheckbox.dart';

class SingleRowCard extends StatefulWidget {
  bool isChecked;
  final VoidCallback? onClick;
  final Function(bool?)? onCheckChange;
  final Widget content;

  SingleRowCard({
    super.key,
    this.isChecked = false,
    this.onCheckChange,
    this.onClick,
    required this.content,
  });

  @override
  State<SingleRowCard> createState() => _SingleRowCardState();
}


class _SingleRowCardState extends State<SingleRowCard> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 54,
      padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
      decoration: BoxDecoration(
        border: Border(
          bottom: BorderSide(color: Color.fromRGBO(238, 238, 238, 1), width: 1),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          RoundCheckBox(
            size: 26,
            checkedColor: Colors.blue,
            isChecked: widget.isChecked,
            onTap: widget.onCheckChange,
          ),
          SizedBox(width: 10),
          Expanded(child: widget.content),
          ElevatedButton(
            onPressed: widget.onClick,
            style: ElevatedButton.styleFrom(
              backgroundColor: Colors.blue,
              padding: EdgeInsets.symmetric(horizontal: 10),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(3),
              ),
            ),
            child: Text(
              '查看',
              style: TextStyle(fontSize: 18, color: Colors.white),
            ),
          ),
        ],
      ),
    );
  }
}
